package com.msw.design.observer;

import java.util.Observable;

/**
 * 观察者设计模式:
 * 1. Event_Driverd
 * 2. 配置文件改变,通知
 * 3. guava中的Event
 *
 * <p/>
 * Created by hadoop on 16-2-17.
 */
public class MyObservable extends Observable {
    // producet price
    private int price;

    public void setPrice(int price)
    {
        // when product price changed, send notice to observer
        if (this.price != price)
        {
            this.price = price;
            // notice observer
            super.setChanged();
            super.notifyObservers();
        }
    }
}
